<?php

/**
 * This is the model class for table "classification".
 *
 * The followings are the available columns in table 'classification':
 * @property integer $id
 * @property string $classroom
 * @property string $other
 * @property integer $no_of_door
 * @property string $direction
 * @property string $angle_of_swing
 * @property string $width
 * @property string $units_of_measurement_of_the_width
 * @property integer $window_opening_provided
 * @property string $wop_width
 * @property string $units_of_measurement_of_the_wop_width
 * @property string $wop_height
 * @property string $units_of_measurement_of_the_wop_height
 * @property string $occupancy_classification
 * @property string $health_type
 * @property integer $any_renovation
 * @property string $industrial_type
 * @property string $class
 * @property integer $windowless
 * @property integer $underground
 * @property string $miscellaneous_type
 * @property integer $fire_alarm_provided
 * @property integer $smoke_or_heat_detector_provided
 * @property integer $ac_or_dc_emergency_light_provided
 * @property integer $first_aid_fire_protection
 * @property integer $lightning_protection_protected
 * @property integer $grounding_system_provided
 * @property string $type_of_exit_required
 * @property string $door
 * @property string $residential_type
 * @property string $storage_type
 * @property string $content
 * @property string $height_of_stack
 * @property string $storage_tank_or_container_installation
 * @property integer $no_of_tank
 * @property integer $distance_from_adjoining_building
 * @property integer $property_line
 * @property integer $between_tanl
 * @property integer $dike_or_catch_basin_provided
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 * @property StorageTankOrContainer[] $storageTankOrContainers
 */
class Classification extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Classification the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
const a = "LessThan 50";
const b ="MoreThan 50";
public function getClassroom(){
return array(
self::a=>"LessThan 50",
self::b=>"MoreThank 50"
);


}

const c = "New";
const d ="Existing";
public function getOccupancy_classification(){
return array(
self::c=>"New",
self::d=>"Existing"
);


}


const f = "Health Care Facility";
const g ="Residential Custodial Care";
const h ="Residential Restrained Care";
public function getHealth_type(){
return array(
self::f=>"Health Care Facility",
self::g=>"Residential Custodial Care",
self::h=>"Residential Restrained Care"
);


}

const i = "General Industrial";
const j= "Special Purpose Industrial";
const k ="Open Industrial";
public function getIndustrial_type(){
return array(
self::i=>"General Industrial",
self::j=>"Special Purpose Industrial",
self::k=>"Open Industrial"
);


}

const l = "1000 Or More";
const m ="300-1000";
const n ="50-300";
public function getClass(){
return array(
self::l=>"1000 Or More",
self::m=>"300-1000",
self::n=>"50-300"
);


}

const o = "Aboveground";
const p ="Underground";
public function getStorage_tank_or_container_installation(){
return array(
self::o=>"Aboveground",
self::p=>"Underground"
);


}

const q = "Foot";
const r ="Inches";
public function getMeasurementa(){
return array(
self::q=>"Foot",
self::r=>"Inches"
);


}

const s = "Foot";
const t ="Inches";
public function getMeasurementb(){
return array(
self::s=>"Foot",
self::t=>"Inches"
);


}

const u = "Foot";
const v ="Inches";
public function getMeasurementc(){
return array(
self::u=>"Foot",
self::v=>"Inches"
);


}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'classification';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('inspection_id', 'required'),
			array('no_of_door, window_opening_provided, any_renovation, windowless, underground, fire_alarm_provided, smoke_or_heat_detector_provided, ac_or_dc_emergency_light_provided, first_aid_fire_protection, lightning_protection_protected, grounding_system_provided, no_of_tank, distance_from_adjoining_building, property_line, between_tanl, dike_or_catch_basin_provided, inspection_id', 'numerical', 'integerOnly'=>true),
			array('classroom, class', 'length', 'max'=>12),
			array('width, wop_width, wop_height, storage_tank_or_container_installation', 'length', 'max'=>11),
			array('units_of_measurement_of_the_width, units_of_measurement_of_the_wop_width, units_of_measurement_of_the_wop_height', 'length', 'max'=>6),
			array('occupancy_classification', 'length', 'max'=>8),
			array('health_type', 'length', 'max'=>27),
			array('industrial_type', 'length', 'max'=>26),
			array('other, direction, angle_of_swing, miscellaneous_type, type_of_exit_required, door, residential_type, storage_type, content, height_of_stack', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, classroom, other, no_of_door, direction, angle_of_swing, width, units_of_measurement_of_the_width, window_opening_provided, wop_width, units_of_measurement_of_the_wop_width, wop_height, units_of_measurement_of_the_wop_height, occupancy_classification, health_type, any_renovation, industrial_type, class, windowless, underground, miscellaneous_type, fire_alarm_provided, smoke_or_heat_detector_provided, ac_or_dc_emergency_light_provided, first_aid_fire_protection, lightning_protection_protected, grounding_system_provided, type_of_exit_required, door, residential_type, storage_type, content, height_of_stack, storage_tank_or_container_installation, no_of_tank, distance_from_adjoining_building, property_line, between_tanl, dike_or_catch_basin_provided, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
			'storageTankOrContainers' => array(self::HAS_MANY, 'StorageTankOrContainer', 'classification_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'classroom' => 'Classroom',
			'other' => 'Other',
			'no_of_door' => 'No Of Door',
			'direction' => 'Direction',
			'angle_of_swing' => 'Angle Of Swing',
			'width' => 'Width',
			'units_of_measurement_of_the_width' => 'Units Of Measurement Of The Width',
			'window_opening_provided' => 'Window Opening Provided',
			'wop_width' => 'Wop Width',
			'units_of_measurement_of_the_wop_width' => 'Units Of Measurement Of The Wop Width',
			'wop_height' => 'Wop Height',
			'units_of_measurement_of_the_wop_height' => 'Units Of Measurement Of The Wop Height',
			'occupancy_classification' => 'Occupancy Classification',
			'health_type' => 'Health Type',
			'any_renovation' => 'Any Renovation',
			'industrial_type' => 'Industrial Type',
			'class' => 'Class',
			'windowless' => 'Windowless',
			'underground' => 'Underground',
			'miscellaneous_type' => 'Miscellaneous Type',
			'fire_alarm_provided' => 'Fire Alarm Provided',
			'smoke_or_heat_detector_provided' => 'Smoke Or Heat Detector Provided',
			'ac_or_dc_emergency_light_provided' => 'Ac Or Dc Emergency Light Provided',
			'first_aid_fire_protection' => 'First Aid Fire Protection',
			'lightning_protection_protected' => 'Lightning Protection Protected',
			'grounding_system_provided' => 'Grounding System Provided',
			'type_of_exit_required' => 'Type Of Exit Required',
			'door' => 'Door',
			'residential_type' => 'Residential Type',
			'storage_type' => 'Storage Type',
			'content' => 'Content',
			'height_of_stack' => 'Height Of Stack',
			'storage_tank_or_container_installation' => 'Storage Tank Or Container Installation',
			'no_of_tank' => 'No Of Tank',
			'distance_from_adjoining_building' => 'Distance From Adjoining Building',
			'property_line' => 'Property Line',
			'between_tanl' => 'Between Tanl',
			'dike_or_catch_basin_provided' => 'Dike Or Catch Basin Provided',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('classroom',$this->classroom,true);
		$criteria->compare('other',$this->other,true);
		$criteria->compare('no_of_door',$this->no_of_door);
		$criteria->compare('direction',$this->direction,true);
		$criteria->compare('angle_of_swing',$this->angle_of_swing,true);
		$criteria->compare('width',$this->width,true);
		$criteria->compare('units_of_measurement_of_the_width',$this->units_of_measurement_of_the_width,true);
		$criteria->compare('window_opening_provided',$this->window_opening_provided);
		$criteria->compare('wop_width',$this->wop_width,true);
		$criteria->compare('units_of_measurement_of_the_wop_width',$this->units_of_measurement_of_the_wop_width,true);
		$criteria->compare('wop_height',$this->wop_height,true);
		$criteria->compare('units_of_measurement_of_the_wop_height',$this->units_of_measurement_of_the_wop_height,true);
		$criteria->compare('occupancy_classification',$this->occupancy_classification,true);
		$criteria->compare('health_type',$this->health_type,true);
		$criteria->compare('any_renovation',$this->any_renovation);
		$criteria->compare('industrial_type',$this->industrial_type,true);
		$criteria->compare('class',$this->class,true);
		$criteria->compare('windowless',$this->windowless);
		$criteria->compare('underground',$this->underground);
		$criteria->compare('miscellaneous_type',$this->miscellaneous_type,true);
		$criteria->compare('fire_alarm_provided',$this->fire_alarm_provided);
		$criteria->compare('smoke_or_heat_detector_provided',$this->smoke_or_heat_detector_provided);
		$criteria->compare('ac_or_dc_emergency_light_provided',$this->ac_or_dc_emergency_light_provided);
		$criteria->compare('first_aid_fire_protection',$this->first_aid_fire_protection);
		$criteria->compare('lightning_protection_protected',$this->lightning_protection_protected);
		$criteria->compare('grounding_system_provided',$this->grounding_system_provided);
		$criteria->compare('type_of_exit_required',$this->type_of_exit_required,true);
		$criteria->compare('door',$this->door,true);
		$criteria->compare('residential_type',$this->residential_type,true);
		$criteria->compare('storage_type',$this->storage_type,true);
		$criteria->compare('content',$this->content,true);
		$criteria->compare('height_of_stack',$this->height_of_stack,true);
		$criteria->compare('storage_tank_or_container_installation',$this->storage_tank_or_container_installation,true);
		$criteria->compare('no_of_tank',$this->no_of_tank);
		$criteria->compare('distance_from_adjoining_building',$this->distance_from_adjoining_building);
		$criteria->compare('property_line',$this->property_line);
		$criteria->compare('between_tanl',$this->between_tanl);
		$criteria->compare('dike_or_catch_basin_provided',$this->dike_or_catch_basin_provided);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}